
<template>
	<el-dialog title=""  visible :show-close="false"   :modal-append-to-body="false" class="wrap" size="tiny">
	<i class="el-icon-close close" @click="cancel" style="color: white;z-index:10"></i>
		 <div class="bt">添加补课</div>
		<el-form label-width="100px" class="form">
			<el-form-item label="班级">
				  <el-input v-model="form.bjmc"  icon="info" class="select-block"></el-input>
			</el-form-item>
			<el-form-item label="学生">
				  <el-input v-model="form.name"  icon="info" class="select-block"></el-input>
			</el-form-item>
			<el-form-item label="老师">
				  <el-input v-model="form.lsmc"  icon="info" class="select-block"></el-input>
			</el-form-item>
			<el-form-item label="补考类型">
				<el-select v-model="bklx"   class="select-block" >
  				<el-option label="考勤补课" value="KQ"></el-option>
  				<el-option label="成绩补课" value="CJ" ></el-option>
  			</el-select>
  		</el-form-item>

			<!-- <el-form-item label="课次">
				  <el-input v-model="lx"  icon="info" class="select-block"></el-input>
			</el-form-item> -->
			<el-form-item label="补课时间 " >
				  <el-date-picker  v-model="bksj"  type="date" class="select-block" placeholder="选择日期" @keyup.enter.native="search">  </el-date-picker>
			</el-form-item>
			<el-form-item label="补课原因">
				  <el-input v-model="bkyy"  type="textarea"  :rows="4" icon="info" class="select-block"></el-input>
			</el-form-item>
		</el-form>
		<el-button type="primary" class="submit" @click="submit">确定</el-button>
	</el-dialog>
</template>

<script type="text/javascript">
	import qs from 'qs'
	export default {
		props: ['params'],
		data() {
			return {
				bklx:'',
				bkyy:'',
				bksj:'',
				form: {
					xsid :'',
					lsid :'',
					type:'',
					bjid:'',
					day:'',
					id: ''
				},
			}
		},
		created() {
           this.form=this.params.row;
//			this.loadinfo();
		},
		methods: {
			submit() {
           console.log(this.params)
            var time1 = this.$.getLocalTimeNo0(Date.parse(this.bksj));
				//检测
				this.$store.state.loading = true;
				//装载数据
				var logininfo = JSON.parse(localStorage.logininfo);
				var params2 = qs.stringify({
					bkyy: this.bkyy+'',
					bksj: time1+'',
					day:  this.params.row.day+'',
					bjid: this.params.row.bjid,
					type: this.bklx+'',
					xsid: this.params.row.xsid+'',
					lsid: this.params.row.lsid+'',
					yhid:logininfo.id,
					xxid:logininfo.xxid,
				})
				//执行
				this.axios.post(this.$store.state.api + 'ls/updateaddbk', params2)
					.then(res => {
						if(res.data.code == 1) {
							this.$emit('close', { type: 'info', cancel: false });
							this.$store.state.loading = false;
						} else {
						    this.$message.warning(res.data.msg);
							this.$store.state.loading = false;
						}
					}).catch(res => {
							this.$message.warning("服务器异常");
							this.$store.state.loading = false;
					})
			},
			cancel() {
				this.$emit('close', { type: 'info', cancel: false })
			}
		}
	}
</script>

<style lang="less" scoped>
	.wrap {
		text-align: center;
	}
	.bt{
			position: absolute;
			top:0;
			left:0;
			width: 100%;
			height: 50px;
			margin: 0 auto;
			background: #50BFFF;
			color:white;
			text-align:left;
			line-height: 50px;
			font-size: 17px;
			padding-left: 15px;
		}
	.form {
		text-align: left;
		margin-top: 20px;
	}
	 .input {
            width: 300px;
            display: inline-block;
        }

	.select-block {
		width:85%;
		display: block;
	}

	.submit {
		width: 120px;
	}
</style>
